
package com.rx.mgt.controller;  

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.rx.mgt.domain.AdminUser;
import com.rx.mgt.po.UsersBo;
import com.rx.mgt.service.SysLogService;
import com.rx.mgt.util.IpUtil;

/** 
 * ClassName:SysLogController 
 * Function :
 * Reason   : 
 * Date     :Feb 6, 2017 3:01:47 PM 
 * @author   luolei 
 * @since    JDK 1.6
 */
@Controller
public class SysLogController {
    @Autowired
    SysLogService sysLogService;
    
    @RequestMapping(value="/sys-log-list.htmlx")
    public String  sysLogList(ModelMap model,UsersBo usersBo){
        List list = sysLogService.getAllLog(usersBo);
        model.addAttribute("list",list);
        model.addAttribute("usersBo",usersBo);
        System.out.println("111111111111111");
        return "sys/sys-log-list";
    }
    @SuppressWarnings({ "rawtypes", "unchecked" })
    @RequestMapping(value="/deleteLog.htmlx")
    @ResponseBody
    public Map  deleteTask(HttpServletRequest request ,String ids){
        AdminUser user = (AdminUser) request.getSession().getAttribute("user");
        sysLogService.add("删除日志", IpUtil.getIpAddr(request), "管理", user.getId()+"", user.getUser_name());
        Map map =new HashMap();
        if(ids!=null){
            String[] id=ids.split(",");
            for(String s:id){
                sysLogService.delete(Long.valueOf(s));
            }
        }
        map.put("result", "success");
        System.out.println("111111111111111");
        return map;
    }

}
  